package com.lzj.mallchat.common.common.exception;

import lombok.Data;

/**
 * @author 罗振军
 * @Description
 * @Package com.lzj.mallchat.common.common.exception
 * @date 2024/8/21 15:20
 */
@Data
public class BusinessException extends RuntimeException {
    protected Integer errCode;
    protected String errMsg;

    public BusinessException(String errMsg) {
        super(errMsg);
        this.errCode = CommonErrorEnum.BUSINESS_ERROR.getErrorCode();
        this.errMsg = errMsg;
    }

    public BusinessException(Integer errCode, String errMsg) {
        super(errMsg);
        this.errCode = errCode;
        this.errMsg = errMsg;
    }

    public BusinessException(ErrorEnum errorEnum) {
        super(errorEnum.getErrorMsg());
        this.errCode = errorEnum.getErrorCode();
        this.errMsg = errorEnum.getErrorMsg();
    }
}
